package org.grow.erp.exception;

import org.grow.common.exception.ElMessageException;
import org.grow.common.exception.ElNoticeException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: xwg
 * @CreateDate: 2022/2/20
 */

@RestControllerAdvice
public class ErpExceptionBridge {

    @ExceptionHandler(ElMessageException.class)
    public ResponseEntity<String> elm(ElMessageException e){
        return new ResponseEntity<String>(e.getMessage(),null,e.getCode());
    }
    @ExceptionHandler(ElNoticeException.class)
    public ResponseEntity<String> eln(ElNoticeException e){
        return new ResponseEntity<String>(e.getMessage(),null,e.getCode());
    }
}
